{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 103,
   "id": "59b8c897",
   "metadata": {},
   "outputs": [],
   "source": [
    "import cv2\n",
    "import os\n",
    "import os.path as osp\n",
    "import matplotlib.pyplot as plt\n",
    "import torchvision.transforms as transforms\n",
    "import torch.nn as nn\n",
    "import shutil\n",
    "import torch\n",
    "import torchvision"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 39,
   "id": "c2a3811b-62f5-41c0-9bf2-38c9321f108a",
   "metadata": {},
   "outputs": [],
   "source": [
    "video_frame_path = r'D:\\Hresource\\PicsFromVideo'"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 36,
   "id": "44771fe2-4ec0-4628-847c-ca0738932e70",
   "metadata": {},
   "outputs": [],
   "source": [
    "model_path = r'D:\\Hresource\\Models\\res34.pth'"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 80,
   "id": "a5455cac-566a-4890-b8c2-f8f7e6b13f85",
   "metadata": {},
   "outputs": [],
   "source": [
    "model = torchvision.models.resnet34(pretrained=True)\n",
    "num_ftrs = model.fc.in_features\n",
    "model.fc = nn.Sequential(\n",
    "    nn.Linear(num_ftrs, 1),\n",
    "    nn.Sigmoid()\n",
    ")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 81,
   "id": "b01dacaa-b9f7-4935-b1e9-f73c5c0ed32f",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "ResNet(\n",
       "  (conv1): Conv2d(3, 64, kernel_size=(7, 7), stride=(2, 2), padding=(3, 3), bias=False)\n",
       "  (bn1): BatchNorm2d(64, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)\n",
       "  (relu): ReLU(inplace=True)\n",
       "  (maxpool): MaxPool2d(kernel_size=3, stride=2, padding=1, dilation=1, ceil_mode=False)\n",
       "  (layer1): Sequential(\n",
       "    (0): BasicBlock(\n",
       "      (conv1): Conv2d(64, 64, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)\n",
       "      (bn1): BatchNorm2d(64, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)\n",
       "      (relu): ReLU(inplace=True)\n",
       "      (conv2): Conv2d(64, 64, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)\n",
       "      (bn2): BatchNorm2d(64, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)\n",
       "    )\n",
       "    (1): BasicBlock(\n",
       "      (conv1): Conv2d(64, 64, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)\n",
       "      (bn1): BatchNorm2d(64, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)\n",
       "      (relu): ReLU(inplace=True)\n",
       "      (conv2): Conv2d(64, 64, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)\n",
       "      (bn2): BatchNorm2d(64, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)\n",
       "    )\n",
       "    (2): BasicBlock(\n",
       "      (conv1): Conv2d(64, 64, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)\n",
       "      (bn1): BatchNorm2d(64, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)\n",
       "      (relu): ReLU(inplace=True)\n",
       "      (conv2): Conv2d(64, 64, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)\n",
       "      (bn2): BatchNorm2d(64, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)\n",
       "    )\n",
       "  )\n",
       "  (layer2): Sequential(\n",
       "    (0): BasicBlock(\n",
       "      (conv1): Conv2d(64, 128, kernel_size=(3, 3), stride=(2, 2), padding=(1, 1), bias=False)\n",
       "      (bn1): BatchNorm2d(128, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)\n",
       "      (relu): ReLU(inplace=True)\n",
       "      (conv2): Conv2d(128, 128, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)\n",
       "      (bn2): BatchNorm2d(128, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)\n",
       "      (downsample): Sequential(\n",
       "        (0): Conv2d(64, 128, kernel_size=(1, 1), stride=(2, 2), bias=False)\n",
       "        (1): BatchNorm2d(128, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)\n",
       "      )\n",
       "    )\n",
       "    (1): BasicBlock(\n",
       "      (conv1): Conv2d(128, 128, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)\n",
       "      (bn1): BatchNorm2d(128, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)\n",
       "      (relu): ReLU(inplace=True)\n",
       "      (conv2): Conv2d(128, 128, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)\n",
       "      (bn2): BatchNorm2d(128, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)\n",
       "    )\n",
       "    (2): BasicBlock(\n",
       "      (conv1): Conv2d(128, 128, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)\n",
       "      (bn1): BatchNorm2d(128, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)\n",
       "      (relu): ReLU(inplace=True)\n",
       "      (conv2): Conv2d(128, 128, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)\n",
       "      (bn2): BatchNorm2d(128, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)\n",
       "    )\n",
       "    (3): BasicBlock(\n",
       "      (conv1): Conv2d(128, 128, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)\n",
       "      (bn1): BatchNorm2d(128, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)\n",
       "      (relu): ReLU(inplace=True)\n",
       "      (conv2): Conv2d(128, 128, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)\n",
       "      (bn2): BatchNorm2d(128, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)\n",
       "    )\n",
       "  )\n",
       "  (layer3): Sequential(\n",
       "    (0): BasicBlock(\n",
       "      (conv1): Conv2d(128, 256, kernel_size=(3, 3), stride=(2, 2), padding=(1, 1), bias=False)\n",
       "      (bn1): BatchNorm2d(256, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)\n",
       "      (relu): ReLU(inplace=True)\n",
       "      (conv2): Conv2d(256, 256, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)\n",
       "      (bn2): BatchNorm2d(256, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)\n",
       "      (downsample): Sequential(\n",
       "        (0): Conv2d(128, 256, kernel_size=(1, 1), stride=(2, 2), bias=False)\n",
       "        (1): BatchNorm2d(256, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)\n",
       "      )\n",
       "    )\n",
       "    (1): BasicBlock(\n",
       "      (conv1): Conv2d(256, 256, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)\n",
       "      (bn1): BatchNorm2d(256, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)\n",
       "      (relu): ReLU(inplace=True)\n",
       "      (conv2): Conv2d(256, 256, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)\n",
       "      (bn2): BatchNorm2d(256, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)\n",
       "    )\n",
       "    (2): BasicBlock(\n",
       "      (conv1): Conv2d(256, 256, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)\n",
       "      (bn1): BatchNorm2d(256, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)\n",
       "      (relu): ReLU(inplace=True)\n",
       "      (conv2): Conv2d(256, 256, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)\n",
       "      (bn2): BatchNorm2d(256, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)\n",
       "    )\n",
       "    (3): BasicBlock(\n",
       "      (conv1): Conv2d(256, 256, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)\n",
       "      (bn1): BatchNorm2d(256, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)\n",
       "      (relu): ReLU(inplace=True)\n",
       "      (conv2): Conv2d(256, 256, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)\n",
       "      (bn2): BatchNorm2d(256, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)\n",
       "    )\n",
       "    (4): BasicBlock(\n",
       "      (conv1): Conv2d(256, 256, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)\n",
       "      (bn1): BatchNorm2d(256, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)\n",
       "      (relu): ReLU(inplace=True)\n",
       "      (conv2): Conv2d(256, 256, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)\n",
       "      (bn2): BatchNorm2d(256, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)\n",
       "    )\n",
       "    (5): BasicBlock(\n",
       "      (conv1): Conv2d(256, 256, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)\n",
       "      (bn1): BatchNorm2d(256, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)\n",
       "      (relu): ReLU(inplace=True)\n",
       "      (conv2): Conv2d(256, 256, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)\n",
       "      (bn2): BatchNorm2d(256, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)\n",
       "    )\n",
       "  )\n",
       "  (layer4): Sequential(\n",
       "    (0): BasicBlock(\n",
       "      (conv1): Conv2d(256, 512, kernel_size=(3, 3), stride=(2, 2), padding=(1, 1), bias=False)\n",
       "      (bn1): BatchNorm2d(512, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)\n",
       "      (relu): ReLU(inplace=True)\n",
       "      (conv2): Conv2d(512, 512, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)\n",
       "      (bn2): BatchNorm2d(512, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)\n",
       "      (downsample): Sequential(\n",
       "        (0): Conv2d(256, 512, kernel_size=(1, 1), stride=(2, 2), bias=False)\n",
       "        (1): BatchNorm2d(512, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)\n",
       "      )\n",
       "    )\n",
       "    (1): BasicBlock(\n",
       "      (conv1): Conv2d(512, 512, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)\n",
       "      (bn1): BatchNorm2d(512, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)\n",
       "      (relu): ReLU(inplace=True)\n",
       "      (conv2): Conv2d(512, 512, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)\n",
       "      (bn2): BatchNorm2d(512, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)\n",
       "    )\n",
       "    (2): BasicBlock(\n",
       "      (conv1): Conv2d(512, 512, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)\n",
       "      (bn1): BatchNorm2d(512, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)\n",
       "      (relu): ReLU(inplace=True)\n",
       "      (conv2): Conv2d(512, 512, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)\n",
       "      (bn2): BatchNorm2d(512, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)\n",
       "    )\n",
       "  )\n",
       "  (avgpool): AdaptiveAvgPool2d(output_size=(1, 1))\n",
       "  (fc): Sequential(\n",
       "    (0): Linear(in_features=512, out_features=1, bias=True)\n",
       "    (1): Sigmoid()\n",
       "  )\n",
       ")"
      ]
     },
     "execution_count": 81,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "model.load_state_dict(torch.load(model_path))\n",
    "model.cuda()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "id": "b4334605-bf13-4404-87a5-a18311a7b437",
   "metadata": {},
   "outputs": [],
   "source": [
    "device = torch.device(\"cuda:0\" if torch.cuda.is_available() else \"cpu\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 41,
   "id": "ec8e7250",
   "metadata": {},
   "outputs": [],
   "source": [
    "video_path = r'D:\\Hresource\\Picked_Video'"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 42,
   "id": "af6b6c3a",
   "metadata": {},
   "outputs": [],
   "source": [
    "f_list = [osp.join(video_path, f) for f in os.listdir(video_path)]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 47,
   "id": "c0714605-f6de-4dc5-80aa-d114c57fb65c",
   "metadata": {},
   "outputs": [],
   "source": [
    "trans = transforms.Compose([\n",
    "    transforms.ToTensor(),\n",
    "    transforms.Resize([224,224])\n",
    "])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 104,
   "id": "e423748a-3047-40ff-be6c-b403def07f95",
   "metadata": {},
   "outputs": [],
   "source": [
    "new_video_path = r'D:\\Hresource\\H-videos'"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 46,
   "id": "9e74f5e3",
   "metadata": {},
   "outputs": [],
   "source": [
    "def ToRGB(img):\n",
    "    return cv2.cvtColor(img, cv2.COLOR_BGR2RGB)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 92,
   "id": "086b55c8-8066-4bc2-b5b2-804234df6899",
   "metadata": {},
   "outputs": [],
   "source": [
    "def savePic(f_name, img):\n",
    "    plt.imsave(f_name, img)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 109,
   "id": "fc2044f9-1846-4c4e-a2eb-f7409f75dbb6",
   "metadata": {},
   "outputs": [],
   "source": [
    "def train_videos(f_list, model):\n",
    "    model.eval()\n",
    "    n = 0\n",
    "    for i in range(len(f_list)):\n",
    "        \n",
    "        f = f_list[i]\n",
    "        print(f\"processing {i + 1} / {len(f_list)}\")\n",
    "        cap = cv2.VideoCapture(f)\n",
    "        fps = cap.get(cv2.CAP_PROP_FPS)\n",
    "        if fps == 0:\n",
    "            continue\n",
    "        total_frames = cap.get(cv2.CAP_PROP_FRAME_COUNT)\n",
    "        video_duration = total_frames / fps\n",
    "        c = 1\n",
    "        frame_interval = cap.get(5) * 1\n",
    "        total_img = total_frames // frame_interval\n",
    "        count = 0\n",
    "        while True:\n",
    "            ret, frame = cap.read()\n",
    "            if ret:\n",
    "                if(c %  frame_interval == 0):\n",
    "                    frame = ToRGB(frame)\n",
    "                    frame_tensor = trans(frame).unsqueeze(0).cuda()\n",
    "                    tar = 1 if model(frame_tensor) > 0.3 else 0\n",
    "                    if tar == 1:\n",
    "                        count += 1\n",
    "                        # name = str(n) + '.jpg'\n",
    "                        # f_name = os.path.join(video_frame_path, name)\n",
    "                        # while os.path.exists(f_name):\n",
    "                        #     n += 1\n",
    "                        #     name = str(n) + '.jpg'\n",
    "                        #     f_name = os.path.join(video_frame_path, name)\n",
    "                        # savePic(f_name, frame)\n",
    "                c += 1\n",
    "            else:\n",
    "                break\n",
    "        radio = count / total_img\n",
    "        if radio >= 0.3:\n",
    "            shutil.copy(f, os.path.join(new_video_path, os.path.basename(f)))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 110,
   "id": "e3477092-327e-4db1-8425-86858b82b1bd",
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "processing 1 / 412\n",
      "processing 2 / 412\n",
      "processing 3 / 412\n",
      "processing 4 / 412\n",
      "processing 5 / 412\n",
      "processing 6 / 412\n",
      "processing 7 / 412\n",
      "processing 8 / 412\n",
      "processing 9 / 412\n",
      "processing 10 / 412\n",
      "processing 11 / 412\n",
      "processing 12 / 412\n",
      "processing 13 / 412\n",
      "processing 14 / 412\n",
      "processing 15 / 412\n",
      "processing 16 / 412\n",
      "processing 17 / 412\n",
      "processing 18 / 412\n",
      "processing 19 / 412\n",
      "processing 20 / 412\n",
      "processing 21 / 412\n",
      "processing 22 / 412\n",
      "processing 23 / 412\n",
      "processing 24 / 412\n",
      "processing 25 / 412\n",
      "processing 26 / 412\n",
      "processing 27 / 412\n",
      "processing 28 / 412\n",
      "processing 29 / 412\n",
      "processing 30 / 412\n",
      "processing 31 / 412\n",
      "processing 32 / 412\n",
      "processing 33 / 412\n",
      "processing 34 / 412\n",
      "processing 35 / 412\n",
      "processing 36 / 412\n",
      "processing 37 / 412\n",
      "processing 38 / 412\n",
      "processing 39 / 412\n",
      "processing 40 / 412\n",
      "processing 41 / 412\n",
      "processing 42 / 412\n",
      "processing 43 / 412\n",
      "processing 44 / 412\n",
      "processing 45 / 412\n",
      "processing 46 / 412\n",
      "processing 47 / 412\n",
      "processing 48 / 412\n",
      "processing 49 / 412\n",
      "processing 50 / 412\n",
      "processing 51 / 412\n",
      "processing 52 / 412\n",
      "processing 53 / 412\n",
      "processing 54 / 412\n",
      "processing 55 / 412\n",
      "processing 56 / 412\n",
      "processing 57 / 412\n",
      "processing 58 / 412\n",
      "processing 59 / 412\n",
      "processing 60 / 412\n",
      "processing 61 / 412\n",
      "processing 62 / 412\n",
      "processing 63 / 412\n",
      "processing 64 / 412\n",
      "processing 65 / 412\n",
      "processing 66 / 412\n",
      "processing 67 / 412\n",
      "processing 68 / 412\n",
      "processing 69 / 412\n",
      "processing 70 / 412\n",
      "processing 71 / 412\n",
      "processing 72 / 412\n",
      "processing 73 / 412\n",
      "processing 74 / 412\n",
      "processing 75 / 412\n",
      "processing 76 / 412\n",
      "processing 77 / 412\n",
      "processing 78 / 412\n",
      "processing 79 / 412\n",
      "processing 80 / 412\n",
      "processing 81 / 412\n",
      "processing 82 / 412\n",
      "processing 83 / 412\n",
      "processing 84 / 412\n",
      "processing 85 / 412\n",
      "processing 86 / 412\n",
      "processing 87 / 412\n",
      "processing 88 / 412\n",
      "processing 89 / 412\n",
      "processing 90 / 412\n",
      "processing 91 / 412\n",
      "processing 92 / 412\n",
      "processing 93 / 412\n",
      "processing 94 / 412\n",
      "processing 95 / 412\n",
      "processing 96 / 412\n",
      "processing 97 / 412\n",
      "processing 98 / 412\n",
      "processing 99 / 412\n",
      "processing 100 / 412\n",
      "processing 101 / 412\n",
      "processing 102 / 412\n",
      "processing 103 / 412\n",
      "processing 104 / 412\n",
      "processing 105 / 412\n",
      "processing 106 / 412\n",
      "processing 107 / 412\n",
      "processing 108 / 412\n",
      "processing 109 / 412\n",
      "processing 110 / 412\n",
      "processing 111 / 412\n",
      "processing 112 / 412\n",
      "processing 113 / 412\n",
      "processing 114 / 412\n",
      "processing 115 / 412\n",
      "processing 116 / 412\n",
      "processing 117 / 412\n",
      "processing 118 / 412\n",
      "processing 119 / 412\n",
      "processing 120 / 412\n",
      "processing 121 / 412\n",
      "processing 122 / 412\n",
      "processing 123 / 412\n",
      "processing 124 / 412\n",
      "processing 125 / 412\n",
      "processing 126 / 412\n",
      "processing 127 / 412\n",
      "processing 128 / 412\n",
      "processing 129 / 412\n",
      "processing 130 / 412\n",
      "processing 131 / 412\n",
      "processing 132 / 412\n",
      "processing 133 / 412\n",
      "processing 134 / 412\n",
      "processing 135 / 412\n",
      "processing 136 / 412\n",
      "processing 137 / 412\n",
      "processing 138 / 412\n",
      "processing 139 / 412\n",
      "processing 140 / 412\n",
      "processing 141 / 412\n",
      "processing 142 / 412\n",
      "processing 143 / 412\n",
      "processing 144 / 412\n",
      "processing 145 / 412\n",
      "processing 146 / 412\n",
      "processing 147 / 412\n",
      "processing 148 / 412\n",
      "processing 149 / 412\n",
      "processing 150 / 412\n",
      "processing 151 / 412\n",
      "processing 152 / 412\n",
      "processing 153 / 412\n",
      "processing 154 / 412\n",
      "processing 155 / 412\n",
      "processing 156 / 412\n",
      "processing 157 / 412\n",
      "processing 158 / 412\n",
      "processing 159 / 412\n",
      "processing 160 / 412\n",
      "processing 161 / 412\n",
      "processing 162 / 412\n",
      "processing 163 / 412\n",
      "processing 164 / 412\n",
      "processing 165 / 412\n",
      "processing 166 / 412\n",
      "processing 167 / 412\n",
      "processing 168 / 412\n",
      "processing 169 / 412\n",
      "processing 170 / 412\n",
      "processing 171 / 412\n",
      "processing 172 / 412\n",
      "processing 173 / 412\n",
      "processing 174 / 412\n",
      "processing 175 / 412\n",
      "processing 176 / 412\n",
      "processing 177 / 412\n",
      "processing 178 / 412\n",
      "processing 179 / 412\n",
      "processing 180 / 412\n",
      "processing 181 / 412\n",
      "processing 182 / 412\n",
      "processing 183 / 412\n",
      "processing 184 / 412\n",
      "processing 185 / 412\n",
      "processing 186 / 412\n",
      "processing 187 / 412\n",
      "processing 188 / 412\n",
      "processing 189 / 412\n",
      "processing 190 / 412\n",
      "processing 191 / 412\n",
      "processing 192 / 412\n",
      "processing 193 / 412\n",
      "processing 194 / 412\n",
      "processing 195 / 412\n",
      "processing 196 / 412\n",
      "processing 197 / 412\n",
      "processing 198 / 412\n",
      "processing 199 / 412\n",
      "processing 200 / 412\n",
      "processing 201 / 412\n",
      "processing 202 / 412\n",
      "processing 203 / 412\n",
      "processing 204 / 412\n",
      "processing 205 / 412\n",
      "processing 206 / 412\n",
      "processing 207 / 412\n",
      "processing 208 / 412\n",
      "processing 209 / 412\n",
      "processing 210 / 412\n",
      "processing 211 / 412\n",
      "processing 212 / 412\n",
      "processing 213 / 412\n",
      "processing 214 / 412\n",
      "processing 215 / 412\n",
      "processing 216 / 412\n",
      "processing 217 / 412\n",
      "processing 218 / 412\n",
      "processing 219 / 412\n",
      "processing 220 / 412\n",
      "processing 221 / 412\n",
      "processing 222 / 412\n",
      "processing 223 / 412\n",
      "processing 224 / 412\n",
      "processing 225 / 412\n",
      "processing 226 / 412\n",
      "processing 227 / 412\n",
      "processing 228 / 412\n",
      "processing 229 / 412\n",
      "processing 230 / 412\n",
      "processing 231 / 412\n",
      "processing 232 / 412\n",
      "processing 233 / 412\n",
      "processing 234 / 412\n",
      "processing 235 / 412\n",
      "processing 236 / 412\n",
      "processing 237 / 412\n",
      "processing 238 / 412\n",
      "processing 239 / 412\n",
      "processing 240 / 412\n",
      "processing 241 / 412\n",
      "processing 242 / 412\n",
      "processing 243 / 412\n",
      "processing 244 / 412\n",
      "processing 245 / 412\n",
      "processing 246 / 412\n",
      "processing 247 / 412\n",
      "processing 248 / 412\n",
      "processing 249 / 412\n",
      "processing 250 / 412\n",
      "processing 251 / 412\n",
      "processing 252 / 412\n",
      "processing 253 / 412\n",
      "processing 254 / 412\n",
      "processing 255 / 412\n",
      "processing 256 / 412\n",
      "processing 257 / 412\n",
      "processing 258 / 412\n",
      "processing 259 / 412\n",
      "processing 260 / 412\n",
      "processing 261 / 412\n",
      "processing 262 / 412\n",
      "processing 263 / 412\n",
      "processing 264 / 412\n",
      "processing 265 / 412\n",
      "processing 266 / 412\n",
      "processing 267 / 412\n",
      "processing 268 / 412\n",
      "processing 269 / 412\n",
      "processing 270 / 412\n",
      "processing 271 / 412\n",
      "processing 272 / 412\n",
      "processing 273 / 412\n",
      "processing 274 / 412\n",
      "processing 275 / 412\n",
      "processing 276 / 412\n",
      "processing 277 / 412\n",
      "processing 278 / 412\n",
      "processing 279 / 412\n",
      "processing 280 / 412\n",
      "processing 281 / 412\n",
      "processing 282 / 412\n",
      "processing 283 / 412\n",
      "processing 284 / 412\n",
      "processing 285 / 412\n",
      "processing 286 / 412\n",
      "processing 287 / 412\n",
      "processing 288 / 412\n",
      "processing 289 / 412\n",
      "processing 290 / 412\n",
      "processing 291 / 412\n",
      "processing 292 / 412\n",
      "processing 293 / 412\n",
      "processing 294 / 412\n",
      "processing 295 / 412\n",
      "processing 296 / 412\n",
      "processing 297 / 412\n",
      "processing 298 / 412\n",
      "processing 299 / 412\n",
      "processing 300 / 412\n",
      "processing 301 / 412\n",
      "processing 302 / 412\n",
      "processing 303 / 412\n",
      "processing 304 / 412\n",
      "processing 305 / 412\n",
      "processing 306 / 412\n",
      "processing 307 / 412\n",
      "processing 308 / 412\n",
      "processing 309 / 412\n",
      "processing 310 / 412\n",
      "processing 311 / 412\n",
      "processing 312 / 412\n",
      "processing 313 / 412\n",
      "processing 314 / 412\n",
      "processing 315 / 412\n",
      "processing 316 / 412\n",
      "processing 317 / 412\n",
      "processing 318 / 412\n",
      "processing 319 / 412\n",
      "processing 320 / 412\n",
      "processing 321 / 412\n",
      "processing 322 / 412\n",
      "processing 323 / 412\n",
      "processing 324 / 412\n",
      "processing 325 / 412\n",
      "processing 326 / 412\n",
      "processing 327 / 412\n",
      "processing 328 / 412\n",
      "processing 329 / 412\n",
      "processing 330 / 412\n",
      "processing 331 / 412\n",
      "processing 332 / 412\n",
      "processing 333 / 412\n",
      "processing 334 / 412\n",
      "processing 335 / 412\n",
      "processing 336 / 412\n",
      "processing 337 / 412\n",
      "processing 338 / 412\n",
      "processing 339 / 412\n",
      "processing 340 / 412\n",
      "processing 341 / 412\n",
      "processing 342 / 412\n",
      "processing 343 / 412\n",
      "processing 344 / 412\n",
      "processing 345 / 412\n",
      "processing 346 / 412\n",
      "processing 347 / 412\n",
      "processing 348 / 412\n",
      "processing 349 / 412\n",
      "processing 350 / 412\n",
      "processing 351 / 412\n",
      "processing 352 / 412\n",
      "processing 353 / 412\n",
      "processing 354 / 412\n",
      "processing 355 / 412\n",
      "processing 356 / 412\n",
      "processing 357 / 412\n",
      "processing 358 / 412\n",
      "processing 359 / 412\n",
      "processing 360 / 412\n",
      "processing 361 / 412\n",
      "processing 362 / 412\n",
      "processing 363 / 412\n",
      "processing 364 / 412\n",
      "processing 365 / 412\n",
      "processing 366 / 412\n",
      "processing 367 / 412\n",
      "processing 368 / 412\n",
      "processing 369 / 412\n",
      "processing 370 / 412\n",
      "processing 371 / 412\n",
      "processing 372 / 412\n",
      "processing 373 / 412\n",
      "processing 374 / 412\n",
      "processing 375 / 412\n",
      "processing 376 / 412\n",
      "processing 377 / 412\n",
      "processing 378 / 412\n",
      "processing 379 / 412\n",
      "processing 380 / 412\n",
      "processing 381 / 412\n",
      "processing 382 / 412\n",
      "processing 383 / 412\n",
      "processing 384 / 412\n",
      "processing 385 / 412\n",
      "processing 386 / 412\n",
      "processing 387 / 412\n",
      "processing 388 / 412\n",
      "processing 389 / 412\n",
      "processing 390 / 412\n",
      "processing 391 / 412\n",
      "processing 392 / 412\n",
      "processing 393 / 412\n",
      "processing 394 / 412\n",
      "processing 395 / 412\n",
      "processing 396 / 412\n",
      "processing 397 / 412\n",
      "processing 398 / 412\n",
      "processing 399 / 412\n",
      "processing 400 / 412\n",
      "processing 401 / 412\n",
      "processing 402 / 412\n",
      "processing 403 / 412\n",
      "processing 404 / 412\n",
      "processing 405 / 412\n",
      "processing 406 / 412\n",
      "processing 407 / 412\n",
      "processing 408 / 412\n",
      "processing 409 / 412\n",
      "processing 410 / 412\n",
      "processing 411 / 412\n",
      "processing 412 / 412\n"
     ]
    }
   ],
   "source": [
    "train_videos(f_list,model)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "50d7c837-84f6-4574-b726-3777d736a022",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.11.5"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
